Writing data in a distributed data storage system

ABSTRACT

Methods, systems, and apparatuses, including computer programs encoded on computer-readable media, for receiving a write request that includes data and a client address at which to store the data. The data is segmented into the one or more storage units. A storage unit identifier for each of the one or more storage units is computed that uniquely identifies content of a storage unit. A mapping between each storage unit identifier to a block server is determined. For each of the one or more storage units, the storage unit and the corresponding storage unit identifier is sent to a block server. The block server stores the storage unit and information on where the storage unit is stored on the block server for the storage unit identifier. Multiple client addresses associated with a storage unit with the same storage unit identifier are mapped to a single storage unit.

CROSS REFERENCE TO RELATED APPLICATIONS

The present application is a continuation of U.S. application Ser. No.14/684,956, filed Apr. 13, 2015, now U.S. Pat. No. 9,507,537, which is acontinuation of U.S. application Ser. No. 14/454,197, filed Aug. 7,2014, now U.S. Pat. No. 9,383,933, which is a continuation of U.S.application Ser. No. 13/041,122, filed Mar. 4, 2011, now U.S. Pat. No.8,819,208, which claims priority to U.S. Provisional Application No.61/310,863, filed Mar. 5, 2010, the contents of which are incorporatedherein by reference in their entirety.

BACKGROUND

Particular embodiments generally relate to a distributed data storagesystem.

A unit of data, such as a file or object, includes one or more storageunits (e.g., bytes), and can be stored and retrieved from a storagemedium. For example, disk drives in storage systems are divided intological blocks that are addressed using logical block addresses (LBAs).The disk drives use spinning disks where a read/write head is used toread/write data to/from the drive. It is desirable to store an entirefile in a contiguous range of addresses on the spinning disk. Forexample, the file may be divided into blocks or extents of a fixed size.Each block of the file may be stored in a contiguous section of thespinning disk. The file is then accessed using an offset and length ofthe file. The contiguous range of addresses is used because disks aregood at sequential access, but suffer performance degradation whenrandom access to different non-contiguous locations is needed.

Storage systems typically do not have a mechanism to minimize the amountof storage used when duplicate copies of data are stored. Duplicate datamay occur at different locations within a single file or betweendifferent independent files all in the same file system. However,because clients store data based on addresses in the storage medium,duplicate data is typically stored. For example, a first client stores afirst file in a first range of addresses and a second client stores asecond file in a second range of addresses. Even if duplicate data isfound in the first file and the second file, storage systems prefer tostore the first file and the second file in separate contiguouslocations so that the data for either file can be accessed sequentially.

Some storage systems, such as a write-anywhere file layout (WAFL), alogical volume manager (LVM), or new technology file system (NTFS),allow multiple objects to refer to the same blocks through a treestructure to allow for efficient storage of previous versions. Forexample, a snapshot feature may eliminate some duplicate data caused bymultiple versions of the same file, but this is only to the extent thatdifferent versions are created and controlled by the file system itself.

Some data storage systems can identify and eliminate duplicate copies ofdata within or between files. However, these systems typically deal withmonolithic systems. For example, the elimination may occur on a singlecomputer system.

SUMMARY

In one embodiment, a method is provided for accessing data that includesone or more storage units. An access request for data is received. Theaccess request includes a client address for the data. A metadata serverdetermines a mapping between the client address and one or more storageunit identifiers for the data. Each of the one or more storage unitidentifiers uniquely identifies content of a storage unit and themetadata server stores mappings on storage unit identifiers that arereferenced by client addresses. The one or more storage unit identifiersare sent to one or more block servers. The one or more block serversservice the request using the one or more storage unit identifiers wherethe one or more block servers store information on where a storage unitis stored on a block server for a storage unit identifier. Also,multiple client addresses associated with a storage unit with a samestorage unit identifier are mapped to a single storage unit stored in astorage medium for a block server.

In one embodiment, the access request is a write request. The methodfurther includes determining a block server in the one or more blockservers based on a storage unit identifier in the one or more storageunit identifiers, wherein different block servers are associated withdifferent ranges of storage unit identifiers and sending the storageunit identifier and the storage unit to the block server associated withthe storage unit identifier.

In one embodiment, the access request is a read request. The methodfurther includes: determining a storage unit identifier in the one ormore storage unit identifiers for a storage unit in the one or morestorage units; determining a block server in the one or more blockservers that is storing the storage unit based on the storage unitidentifier, wherein different block servers are associated withdifferent ranges of storage unit identifiers; and sending the readrequest with the storage unit identifier to the determined block server.

In one embodiment, the data includes a plurality of storage unitsassociated with the client address and the plurality of storage unitsare stored in a non-contiguous address space on a plurality of blockservers.

In one embodiment, the storage medium includes a solid state storagedevice.

In one embodiment, a non-transitory computer-readable storage mediumcontains instructions for accessing data that includes one or morestorage units. The instructions are for controlling a computer system tobe operable to: receive an access request for data, the access requestincluding a client address for the data; determine, by a metadataserver, a mapping between the client address and one or more storageunit identifiers for the data, each of the one or more storage unitidentifiers uniquely identifying content of a storage unit, wherein themetadata server stores mappings on storage unit identifiers that arereferenced by client addresses; and send the one or more storage unitidentifiers to one or more block servers, the one or more block serversservicing the request using the one or more storage unit identifiers,wherein the one or more block servers store information on where astorage unit is stored on a block server for a storage unit identifier,wherein multiple client addresses associated with a storage unit with asame storage unit identifier are mapped to a single storage unit storedin a storage medium for a block server.

In one embodiment, a system includes a metadata server configured to:store mappings on storage unit identifiers that are referenced by clientaddresses; receive an access request for data, the access requestincluding a client address for the data; and compute one or more storageunit identifiers for the data, each of the one or more storage unitidentifiers uniquely identifying content of a storage unit. The systemalso includes a plurality of block servers wherein block servers areassociated with different ranges of storage unit identifiers and storeinformation on where a storage unit is stored on a block server for astorage unit identifier, wherein each block server is configured to:receive a storage unit in the one or more storage units if a storageunit identifier corresponds to the range of storage unit identifiersassociated with the block server; and service the request using thereceived storage unit identifier. Also, multiple client addressesassociated with a storage unit with a same storage unit identifier aremapped to a single storage unit stored in a storage medium in a blockserver.

The following detailed description and accompanying drawings provide abetter understanding of the nature and advantages of the presentinvention.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 depicts a system for a distributed data storage system accordingto one embodiment.

FIG. 2 depicts an example of metadata according to one embodiment.

FIG. 3 depicts a more detailed example of the system according to oneembodiment.

FIG. 4A depicts a simplified flowchart of a method for writing data at ametadata server according to one embodiment.

FIG. 4B depicts a simplified flowchart for processing a write request ata block server according to one embodiment.

FIG. 5A depicts a simplified flowchart of a method for processing a readrequest at the metadata server according to one embodiment.

FIG. 5B depicts a simplified flowchart of a method for processing a readrequest at the block server according to one embodiment.

FIG. 6A depicts a simplified flowchart of a method for computing a Bloomfilter at the metadata server according to one embodiment.

FIG. 6B depicts a simplified flowchart of a method for processing aBloom filter at the block server according to one embodiment.

FIG. 7 depicts a more detailed example of the system according to oneembodiment.

DETAILED DESCRIPTION

Described herein are techniques for a distributed data storage system.In the following description, for purposes of explanation, numerousexamples and specific details are set forth in order to provide athorough understanding of embodiments of the present invention.Particular embodiments as defined by the claims may include some or allof the features in these examples alone or in combination with otherfeatures described below, and may further include modifications andequivalents of the features and concepts described herein.

Overview

FIG. 1 depicts a system 100 for a distributed data storage systemaccording to one embodiment. System 100 includes a client layer 102, ametadata layer 104, and a block server layer 106.

Client layer 102 includes one or more clients 108 a-108 n. Metadatalayer 104 includes one or more metadata servers 110 a-110 n. Blockserver layer 106 includes one or more block servers 112 a-112 n.Although the parts of system 100 are shown as being logically separate,entities may be combined in different fashions. For example, thefunctions of any of the layers may be combined into a single process orsingle machine (e.g., a computing device) and multiple functions or allfunctions may exist on one machine or across multiple machines. Also,when operating across multiple machines, the machines may communicateusing a network interface, such as a local area network (LAN) or a widearea network (WAN). In one embodiment, one or more metadata servers 110may be combined with one or more block servers 112 in a single machine.Entities in system 100 may be virtualized entities. For example,multiple virtual block servers 112 may be included on a machine.Entities may also be included in a cluster, where computing resources ofthe cluster are virtualized such that the computing resources appear asa single entity.

Clients 108 include client processes that may exist on one or morephysical machines. When the term “client 108” is used in the disclosure,the action being performed may be performed by a client process. Aclient process is responsible for storing, retrieving, and deleting datain system 100. A client process may address pieces of data depending onthe nature of the storage system and the format of the data stored. Forexample, the client process may reference data using a client address.The client address may take different forms. For example, in a storagesystem that uses file storage, client 108 may reference a particularvolume or partition, and a file name. With object storage, the clientaddress may be a unique object name. For block storage, the clientaddress may be a volume or partition, and a block address. Clients 108communicate with metadata layer 104 using different protocols, such assmall computer system interface (SCSI), Internet small computer systeminterface (ISCSI), fibre channel (FC), common Internet file system(CIFS), network file system (NFS), hypertext transfer protocol (HTTP),web-based distributed authoring and versioning (WebDAV), or a customprotocol.

Block servers 112 store data for clients 108. In one embodiment, datamay be broken up into one or more storage units. Data may be segmentedinto data blocks. Data blocks may be of a fixed size, may be initially afixed size but compressed, or may be of a variable size. Data blocks mayalso be segmented based on the contextual content of the block in alarger data string. Maintaining segmentation of the blocks on a write(and corresponding re-assembly on a read) may occur in client layer 102and/or metadata layer 104. Also, compression may occur in client layer102, metadata layer 104, and/or block server layer 106.

In one example, data may be stored in a volume that is referenced byclient 108. A volume may be made up of one or more volume slices. Thedata associated with the volume includes a list of volume slices forthat volume. A volume slice is a list of blocks for a portion of avolume. A block is the raw data for a volume and may be the smallestaddressable unit of data. In one embodiment, a data block may bereferred to as a storage unit. However, a storage unit may also refer toother subsets of data. For discussion purposes, the term data block willbe used instead of a storage unit.

Block servers 112 store data on a storage medium. The storage medium mayinclude different medium formats. For example, electromechanical diskstorage or solid state storage drive may be used. Electromechanical diskstorage may include spinning disks that use movable read/write heads toread/write to/from different locations of the spinning disks. Insertingthe read/write head at various random locations results in slower dataaccess than if data is read from a sequential location. A solid statestorage drive uses a solid state memory to store persistent data. Solidstate drives use microchips that store data in non-volatile memory chipsand contain no moving parts. Also, solid state drives can perform randomaccess and parallel reads/writes efficiently.

Data blocks may be stored in block server layer 106 based on uniqueblock identifiers. A block identifier is an identifier that isdetermined based on the content of the data block. The block identifieris unique to that block of data. For example, blocks with the samecontent have the same block identifier, but blocks with differentcontent have different block identifiers. Block servers 112 maintain amapping between a block identifier and the location of the data block ina storage medium of block server 112. As will be discussed in moredetail below, data blocks with the same block identifiers are not storedmultiple times on a block server 112 when received in multiple clientwrite requests.

Metadata layer 104 stores metadata that maps between client layer 102and block server layer 106. For example, metadata servers 110 mapbetween the client addressing used by clients 108 (e.g., file names,object names, block numbers, etc.) and block layer addressing (e.g.,block identifiers) used in block server layer 106. Clients 108 mayperform access based on client addresses. However, block servers 112 donot store data based on client addresses. Rather, as will be discussedin more detail below, block servers 112 store data based on unique blockidentifiers for the data.

FIG. 2 depicts an example of metadata according to one embodiment. At200, the metadata includes a client address 202 and block identifiers204. Client address 202 is the address referenced by client to performaccess to data. For example, when clients want to read, write, or deletedata, the client address for that data is used. The client addressreferences the address in which client 102 thinks the data is stored inblock server layer 106. The client address may use different formats.For example, client address 202 may reference a particular volume orpartition, and a file name. With object storage, client address 202 maybe a unique object name. For block storage, client address 202 mayinclude a volume or partition, and a block address.

At 204, an example of metadata for file-oriented storage is shown. Afile name 206 is the name of a file. A list of block identifiers 208 isthen associated with file name 206. The block identifiers may behexadecimal numbers, but other representations may be used. Additionalmetadata may also be included, such as inode numbers, directorypointers, modification dates, file size, etc. Block identifiers areidentifiers that uniquely identify the data of the file. For example,each block identifier uniquely identifies a data block in the file.

At 210, metadata for a block-based system is shown. A volume name 212 isthe name of the volume. A list of blocks 214 identifies blocks in thevolume using block addresses. Also, a list of block identifiers 208 isassociated with the lists of blocks 214. The client address in this casemay be a volume name 212 and one or more block addresses in lists ofblocks 214.

FIG. 3 depicts a more detailed example of system 100 according to oneembodiment. FIG. 3 shows how data is stored in system 100. A client 108a (client 1) and a client 108 b (client 2) may both wish to read and/orwrite data. For example, client 1 may wish to write data to a volume ata client address 1. For example, client address 1 may be a target nameof the volume and a list of block identifiers (logical block addresses).The data that client 1 wishes to write includes data blocks A F, K, andL.

Client 2 may wish to write data at client address 2. For example, clientaddress 2 may reference a different volume than client address 1 and adifferent list of block identifiers. Other formats of client addressingmay also be used. For discussion purposes, client address 1 and clientaddress 2 are used to reference the respective data blocks and datablock identifiers. The data that client 2 wishes to write may includedata blocks F, K, B, and A. Accordingly, data blocks A, F, and K areduplicates between the data that client 1 and client 2 wish to write.

Metadata layer 104 is shown as including metadata server 110 a (metadataserver 1) and metadata server 110 b (metadata server 2). Differentmetadata servers may be associated with different client addresses. Forexample, different metadata servers 110 may manage different volumes ofdata. In this example, metadata server 1 is designated as handlingclient address 1 and metadata server 2 is designated as handling clientaddress 2.

For each client address, a list of block identifiers is stored. Theblock identifiers represent data blocks associated with the clientaddress. For example, for client address 1, the block identifiers ofblock ID A, block ID F, block ID K, and block ID L are stored andassociated with client address 1. Each block identifier is associatedwith a block of data. Similarly, in metadata server 2, client address 2is associated with block IDs F, K, B, and A.

Block server layer 106 includes block servers 112 a, 112 b, and 112 c(block servers 1, 2, 3, respectively). In one embodiment, block servers112 are assigned to different ranges of block identifiers. For example,block server 1 is assigned to store data for block identifiers A-E,block server 2 stores data for block identifiers F-J, and block server 3stores data for block identifiers K-O. In this case, data for a clientaddress may not be stored in sequential locations on a storage medium ina single block server 112. Rather, the data is stored based on the blockidentifier determined for data.

Block server 1 stores data for block identifier A and block identifierB. Block server 1 maintains a mapping between the block identifier andthe location on the storage medium where the data associated with blockidentifier A is stored. For example, block identifier A is mapped to alocation 1 where data for block identifier A is stored on block server 1and block identifier B is mapped to a location 2 where data for blockidentifier B is stored on block server 1. Also, block server 2 storesdata for block identifier F in location 3 on block server 2, and blockserver 3 stores data for block identifiers K and L in locations 4 and 5,respectively, in block server 3.

Particular embodiments allow for the real time de-duplication of data.For example, client address 1 is associated with data for blocks A, F,K, and L and client address 2 is associated with data for blocks F, K,B, and A. Blocks A, B, and K are duplicated across client address 1 andclient address 2. Although not shown in this example, de-duplication mayalso occur within data for a single client address. Instead of storingtwo copies of blocks A, B, and K, block server 1 stores one copy each ofdata block A and data block B. Also, block server 3 stores one copy ofdata block K. Thus, duplicate blocks A, B, and K are not stored in blockservers 112. This may efficiently use data storage on block servers 112.Using the above scheme, the blocks for a client address may not bestored in sequential locations on a storage medium 114. For example, forclient address 1, block A is stored on block server 1 in storage medium114 a, block F is stored on block server 2 in storage medium 114 b, andblocks K and L are stored on block server 3 in storage medium 114 c.

In one embodiment, storage medium 114 in block server 112 may be a solidstate device, such as non-volatile memory (e.g., flash memory). Thesolid state device may be electrically programmed and erased. The datablocks may be stored on the solid state device and persist when blockserver 112 is powered off. Solid state devices allow random access todata in an efficient manner and include no physical moving parts. Forexample, the random access is more efficient using solid state devicesthan if a spinning disk is used. Thus, data stored in data blocks for aclient address in a non-contiguous address space and even differentblock servers 112 may still be accessed efficiently.

In one embodiment, storage medium 114 may include multiple solid statedrives (e.g., flash memory drives). Each drive may store data for aportion of the block identifiers. Although a solid state device isdescribed, it will be understood that spinning disks may also be usedwith particular embodiments.

Particular embodiments may perform reading, writing, and deleting ofdata. The following will describe each process separately.

Write Requests

FIG. 4A depicts a simplified flowchart 400 of a method for writing dataat metadata server 110 according to one embodiment. At 402, a requestfor writing data is received from client 108 for a client address. At404, metadata server 110 segments the data into blocks. At 406, metadataserver 110 may manipulate the data blocks. For example, the data blocksmay be compressed. However, compression may not be performed.

At 408, metadata server 110 computes a block identifier for each datablock. In one embodiment, a unique block identifier is determined foreach data block. For example, a cryptographic hash, such as a securehash algorithm (SHA)-1, SHA-256, or message-digest algorithm 5 (MD-5),over the data block may be used. The hash value (or a variant of acomputed hash value) is then used as the block identifier.

At 410, metadata server 110 determines one or more block servers inwhich to store the data blocks. To determine which block servers 112 touse, a mapping between the block identifier and a list of block servers112 is determined. As discussed above, different block servers 112service different ranges of block identifiers. Different methods may beused to map between block identifiers and block servers 112, such as atable that maps each range of block identifiers to one or more blockservers 112, consistent hashing, or a straight hash of the identifier.

At 412, block servers 112 are sent a request to store the data block.For example, different block servers associated with the different blockidentifiers are sent different requests.

FIG. 4B depicts a simplified flowchart 450 for processing a writerequest at a block server 112 according to one embodiment. At 452, blockserver 112 receives the request to store a data block. The method willbe described with respect to one block server 112; however, it will beunderstood that multiple block servers 112 may receive different writerequests for different block identifiers.

At 454, block server 112 determines if the block identifier alreadyexists on the block server. For example, if the data block identified bythe block identifier is already stored on block server 112, block server112 may already have stored a mapping between the block identifier and alocation on a storage medium 114.

At 456, if the data block is already stored, then the data block is notstored again. Some other data may need to be updated if the data blockhas already been stored. For example, an “in use” flag may be set foruse during data deletion, which will be described later.

If the data block does not exist, then at 458, the data block is storedin a location by block server 112. Block server 112 may also compressthe data block if it has not been compressed already. At 460, a mappingbetween the block identifier and the location is stored.

At 462, block server 112 updates metadata server 110 to indicate thedata block was already stored or the data block was just stored. Also,metadata server 110 may insert a mapping between the client address andthe block ID upon receiving the indication.

Referring to FIG. 3, the write process will be described. In oneexample, client 108 a may wish to write data to client address 1. Datablocks A, F, K, and L are received at metadata server 110 a (or 110 b).A hash value for each data block is determined. Metadata server 110 athen determines which block servers 112 are assigned to service thewrite request based on the block identifiers. In this case, data block Ais sent to block server 112 a, data block F is sent to block server 112b, and data blocks K and L are sent to block server 112 c. Once eachblock server 112 stores the respective block(s), confirmation isreceived at metadata server 110 a and the block identifiers are storedwith client address 1.

Client 108 b may then wish to write data to client address 2. Datablocks F, K, B, and A are received at metadata server 110 a (or 110 b).A hash value for each data block is determined. Metadata server 110 athen determines data blocks A and B are sent to block server 112 a, datablock F is sent to block server 112 b, and data block K is sent to blockserver 112 c. Block server 112 a determines that data block A exists onstorage medium 114 a and thus does not need to be stored again. However,data block B is not located on storage medium 114 a and is stored.Confirmation that data blocks A and B have been stored is sent tometadata server 110 a. Block server 112 b determines that data block Fhas already been stored and thus does not store data block F again.Confirmation that data block F has been stored is sent to metadataserver 110 a. Block server 112 c determines that data block K hasalready been stored and thus does not store data block K again.Confirmation that data block K has been stored is sent to metadataserver 110 a. Once each block server 112 stores the respective block(s),metadata server 110 a stores the block identifiers with client address2.

Read Requests

A read request will now be described. FIG. 5A depicts a simplifiedflowchart 500 of a method for processing a read request at metadataserver 110 according to one embodiment. At 502, a request for readingdata at a client address is received from client 108 at metadata server110. The request may reference a client address, but not specific blockservers 112. This is because metadata layer 104 is abstracting blockserver layer 106 from client layer 102. In this case, client 108 mayassume that data has been stored with respect to the client address in asequential manner in block server layer 106.

At 504, metadata server 110 determines block identifiers for therequested data. For example, metadata server 110 may look up a mappingof the client address to block identifiers.

At 506, metadata server 110 determines which block servers 112 arecurrently storing the data for each block identifier. As discussedabove, data for different block identifiers may be stored on differentblock servers 112 that service different ranges of block identifiers.Metadata server 110 determines the different block servers 112 based onthe ranges of block identifiers determined. At 508, metadata server 110sends a request to each block server 112 that manages a blockidentifier.

FIG. 5B depicts a simplified flowchart 550 of a method for processing aread request at a block server 112 according to one embodiment. Themethod is described with respect to a single block server 112; however,the method may be applied to all block servers 112 that are sentrequests.

At 552, block server 112 receives a request for a data block identifier.At 554, block server 112 locates the requested data block based on theblock identifier. For example, block server 112 may access a mappingbetween the block identifier and the location of the stored block data.Different methods may be used to access the location, such as an on-diskhash table or tree, an in-memory hash table or tree, a sorted list ofdata blocks, or a database of block identifiers.

At 556, once the data block is located, block server 112 retrieves therequested data block. If the data block was compressed by block server112, it may be decompressed before being returned to client 108. In oneembodiment, block server 112 may return the data block to client 108directly, or the data block may be returned to the metadata server 110that requested the data block.

Referring to FIG. 3, in one example, client 108 a may wish to read datafrom client address 1. A read request for client address 1 is receivedat metadata server 110 a (or 110 b). Because of the de-duplication ofdata, the data blocks A, F, K, and L may not have been stored on acontiguous address space for client address 1. Metadata server 110 adetermines the block identifiers for the data blocks. The associatedblock servers 112 for the block identifiers are then determined. A readrequest is then sent to the determined block servers 112. For example,block server 112 a is sent a read request for data block A, block server112 b is sent a read request for data block F, and block server 112 c issent a read request for data blocks K and L. Block servers 112 a-cretrieve the data blocks based on the block identifiers and send thedata blocks to metadata server 110 a. Metadata server 110 a then sendsthe data blocks to client 108 a.

Data Deletion

The deletion of data will now be described. Data may be deleted fromsystem 100 when a client address in which the data is stored isoverwritten with other data or when a client address becomes invalid(e.g., a file or object is deleted). However, because there is not a 1:1mapping between client addresses and stored data blocks (e.g., becausethere are multiple client addresses that have the same data blockreferenced by the same block identifier), system 100 needs to make surethat data is only deleted when it is no longer needed. For example, adata block should not be deleted if it is being referenced by anotherclient address.

Block servers 112 do not know which clients 112 are referencing the datablocks. This is because metadata server 110 is used to abstract theclient addresses. Accordingly, block servers 112 cannot remove anoverwritten or deleted block because block servers 112 do not know ifother clients 108 are using this data block. Because metadata server 110knows which data blocks are in use by client 108, block servers 112 andmetadata servers 110 need to efficiently communicate to determine whichdata blocks are in use and which are not in use. “In use” means a datablock is currently referenced by a client 108 and “not in use” means adata block is not referenced by any clients 108.

Different methods may be used to perform the deletion. One method fortracking which data blocks can be deleted is referred to as “garbagecollection.” Garbage collection is where an algorithm periodically runsto identify data that is no longer needed and then deletes the no longneeded data.

One method of garbage collection may be a mark and sweep method thatinvolves block servers 112 first marking all of their current blockidentifiers using a marker that indicates a block is “not in use”. Thismay be an indication that the data block is not being used. Next, eachmetadata server 110 sends a list of the block identifiers that arecurrently valid (stored at valid client addresses) to block servers 112.Each list may only contain the block identifiers that correspond to eachblock server 112. Each block server 112 then marks each data block inthe list as “in use”. Once all the lists have been processed, blockserver 112 can remove any data blocks whose block identifiers are stillmarked as “not in use” because these data blocks are no longer beingreferenced by any client addresses. Any blocks that are written duringthe garbage collection process may automatically be marked as “in use”so they are not removed at the end of the process. This process removesthe data blocks; however, it requires large lists of addresses to becommunicated between metadata servers 110 and block servers 112. Thismay cause significant overhead if communication occurs over a LAN or WANnetwork.

A second method of garbage collection may be referred to as a Bloomfilter mark and sweep. FIGS. 6A and 6B depict methods for performing aBloom filter mark and sweep method according to one embodiment. Themethods use a filter, such as a Bloom filter, to reduce an amount ofdata that is communicated between metadata servers 110 and block servers112. Although a Bloom filter is discussed, other filters may be used. ABloom filter is a type of bit field that may be used for membershiptesting. A Bloom filter is a compact representation of a set of datathat can be used to later test for the presence of individual elements.For example, the elements A, B, C, and D may be represented in a Bloomfilter. Block server 112 can test whether any of the elements are in theBloom filter. However, the Bloom filter may not be used to generate thelist of elements A, B, C, and D.

In exchange for the reduction in size, a small possibility of an errormay be introduced. For example, a small percentage chance exists that anelement may appear to be present when it is in fact not. This chance oferror may be controlled by selecting a size for the Bloom filter basedon a number of possible elements that can be stored on block server 112.Additionally, an error may not be fatal because the result of the erroris that an element will just not be deleted when it is actually “not inuse”. Accordingly, an error in which a data block is deleted when it isstill being referenced by client 108 does not occur.

FIG. 6A depicts a simplified flowchart 600 of a method for computing aBloom filter at metadata server 110 according to one embodiment. At 602,block servers 112 mark all data block identifiers as “not in use”. At604, each metadata server 110 computes a Bloom filter for in-use blockidentifiers. A single Bloom filter that includes all metadata onmetadata server 110 for all block servers 112 might be computed. Also,multiple Bloom filters for subsets of metadata on metadata server 110for each block server 112 may be computed. The more metadata that isencompassed by the Bloom filter, the larger the Bloom filter is, whichrequires more memory and more network bandwidth to transmit. Whenmultiple Bloom filters are used, such as one Bloom filter for each blockserver 112 or multiple Bloom filters for each block server 112, Bloomfilters may be constructed serially or in parallel. Constructing Bloomfilters in parallel may require more memory, but reduces the number oftimes metadata is read to build the Bloom filters. Similarly, combiningBloom filters before processing on block server 112 allows for fewerpasses through the list of data blocks on block server 112, but mayrequire larger Bloom filters and more memory.

At 606, each metadata server 110 communicates a Bloom filter containingthe valid block identifiers for a specific block server 112 to thatblock server 112. For example, each block server 112 may reference arange of block identifiers. Metadata server 110 may compute a Bloomfilter for data block identifiers in each range. A Bloom filter is thensent to each respective block server 112. In another embodiment, a Bloomfilter for the entire range of data block identifiers may also becomputed and sent to each block server 112.

FIG. 6B depicts a simplified flowchart 650 of a method for processing aBloom filter at block server 112 according to one embodiment. Althoughthe method is described with respect to one block server 112, the methodmay be performed by multiple block servers 112. At 652, a block server112 checks each block identifier present on the block server against thereceived Bloom filter.

At 654, if the Bloom filter indicates the block identifier is in use,block server 112 marks the block identifiers as “in use”. Block server112 may perform this check individually for each Bloom filter from eachmetadata server 110, or block server 112 can combine the Bloom filters(using a standard OR method) and perform the check against combinedfilters at one time.

At 656, block server 112 removes any data blocks whose block identifieris still marked “not in use” because they are no longer referenced byany client address. Any blocks written during the garbage collectionprocess may automatically be marked as “in use” so they are not removedat the end of the process.

In one example, Bloom filters for each block server 112 may beconstructed in parallel on metadata server 110. The amount of metadatacontained in each filter may be limited. For example, a fixed Bloomfilter size is selected (e.g., defined by available memory) and createdfor each block server 112. Metadata on metadata server 110 is processedand Bloom filters are updated with data block identifiers in themetadata. When each Bloom filter reaches the optimal threshold of bitsset (e.g., 50%), the Bloom filter is sent to block server 112 and a newBloom filter is started for that block server 112. Block servers 112process each Bloom filter as the Bloom filter arrives rather thancombining Bloom filters from multiple metadata servers 110.

The Bloom filter mark and sweep method reduces network communicationbandwidth needed between metadata servers 110 and block servers 112. Asmall percentage chance that a block may be indicated as “in use” whenit is no longer actually in use may occur, but a block will not bemarked as “not in use” if the data block was actually still in use.Thus, the integrity of the data storage system is not at risk.

Bloom filters are useful because the filter may be used to representblock identifiers that are referenced by multiple client addresses once.Thus, even if a block identifier is associated with multiple clientaddresses, the block identifier can only be included once in the Bloomfilter. This saves space, but also allows robust testing of whether adata block is in use. Also, the Bloom filter does not increase in sizewhen multiple copies of the same block identifier are included,

Another method of garbage collection may be tracking which data blockscan be deleted from the system using a reference count for each datablock stored on block servers 112. Each time a given block identifier iswritten into a storage medium, a reference count for that data block isincremented (starting at 1 the first time a block identifier iswritten). When a data block is overwritten or deleted by client 108, areference count is decremented until it reaches zero. At this point, noclient addresses reference the block identifier and a correspondingblock data may be deleted.

This method may operate in real time. For example, when a block is nolonger needed, the data block can be immediately detected and deleted tofree space for other data blocks. However, if any reference count isincorrectly incremented or decremented, a data block may either bedeleted when it is still being referenced by a client 108 or not bedeleted although it is no longer being referenced.

Redundancy

Data redundancy is provided to allow system 100 to continue operation inthe event of a failure. One method is to have each storage medium 114used by block servers 112 implement a local redundancy technology, suchas redundant array of independent disks (RAID), to spread data overmultiple storage media 114 to survive the failure of an individualstorage medium. However, in some cases, this method may not survive thefailure of an entire metadata server 112 or block server 112. The dataredundancy is different from de-duplication in that block servers 112may store a data block (or metadata) once on a storage medium 114 inresponse to a write from a client 108. The data block may be replicatedusing additional writes to other storage media 114 found in differentblock servers 112 or different storage media 114 in the same blockserver 112.

In one embodiment, for metadata servers 110, failures may be handled byreplicating the metadata to one or more additional metadata servers 110.Thus, if one metadata server 110 fails, the additional copies ofmetadata may be used to continue accessing the data. Replication may beperformed by client 102 or directly by metadata server 110 in a chainedor fanned-out fashion. For example, client 102 may send multipleread/write requests to multiple metadata servers 110. Also, metadataservers 110 may replicate the write requests to other metadata servers110.

For block servers 112 a, replication may also be performed where eachdata block is replicated to one or more additional block servers 112. Inthis way, a block may always be read and/or written to even if aspecific block server 112 is unavailable. The mapping from blockidentifiers to data blocks may take into account the amount ofredundancy required and map a block identifier to multiple block servers112 where the data block can be stored and retrieved. Replication may beperformed by a client 108 writing to each block server 112 to enable thereplication. Also, a replication may be performed from a block server112 to another block server 112 in a chained or fanned-out fashion.

The above method of redundancy uses additional write commands toreplicate data. Clients 108, metadata servers 110, and/or block servers112 can thus perform the redundancy algorithm without modification ofwhat commands are used. In other conventional methods, such as RAID, aRAID controller or specialized RAID software is needed. Also, in RAID,multiple copies of data are mirrored between storage devices inside thesame system, or a parity system is used to spread the data betweenmultiple storage devices in the same system. Particular embodimentsstore multiple copies on different block servers 112 on differentphysical machines, increasing the recoverability in case of entiresystem failure.

Another method that can be used to handle block server failure is theuse of an erasure code, such as a Reed-Solomon code, to spread the datafor a single block across multiple block servers in such a way that evenif a single block server 112 is unavailable, the data from other blockservers 112 can be used to reconstruct the original data block. Forexample, the code may be used to recover the data from a failed blockserver 112. This method may require less data storage space allowing fora configurable amount of redundancy.

Measuring Space Used

The actual space used by a subset of client data stored in system 100may need to be measured. Conventionally, determining the space used by aparticular client address (e.g., file, volume, or object) within astorage system is determined by measuring the amount of space dedicatedto a client address. This is because of the 1:1 mapping between clientaddress and space. However, in particular embodiments, client data issplit into data blocks and only unique data blocks are stored, which maymake it difficult to determine how much actual storage space is consumedby a single piece of client data or a group of client data. For example,if two objects have the exact same content, the space required is thesize of one object rather than both.

Different methods may be used to determine the actual space used by asubset of client data. A first method to determine the space being usedcreates a list of unique blocks used by the client data that is beingmeasured. In one embodiment, metadata servers 110 are aware of the blockidentifiers for each piece of client data. Once the list of data blockshas been determined, a total size of the data is calculated based on thesize of each block in the list, or by a multiplication if fixed-sizeblocks are being used.

A second method uses a filter, such as a Bloom filter. In this case, theBloom filter is used as a size counter. The Bloom filter is firstemptied. The list of block identifiers contained in the client data thatis being measured is then processed sequentially. For each blockidentifier, it is determined if the block identifier is present in aBloom filter. If the block identifier is, the process continues to thenext block identifier. If the block identifier is not, the blockidentifier is added to the Bloom filter and a size counter isincremented by the size of the block corresponding to the blockidentifier (or a fixed value if fixed-size blocks are being used). Inthe second method, a large list of block identifiers is not kept.Instead, a smaller Bloom filter and size counter are used.

A third method uses a Bloom filter, but not a size counter. A Bloomfilter may start out empty and a list of block identifiers contained inthe client data being measured is sequentially processed. For each blockidentifier, the Bloom filter is checked to see if the block identifieris present. If the block identifier is, the process proceeds to the nextblock identifier. If the block identifier is not, the block identifieris added to the Bloom filter. At the end of the process, the number ofblock identifiers included in the Bloom filter may be estimated, such asusing the following formula: n=log (z/m)/((k*log((1−1/m)))), where zcorresponds to the number of zero bits in the Bloom filter, ncorresponds to the total number of bits in the Bloom filter, and kcorresponds to the number of hash functions used when constructing theBloom filter. To determine the approximate size of the client data, n ismultiplied by the block size (for fixed-size blocks) or by an average orestimate of the block size (for variable size blocks). This method maybe executed in parallel or on multiple metadata servers 110. Eachmetadata server 110 may compute its own Bloom filter using the subset ofclient data it maintained. Finally, the Bloom filters from all metadataservers 110 may be combined (using an OR operation), and the formulaused above estimates a total amount of unique data.

Detailed Example of System

FIG. 7 depicts a more detailed example of system 100 according to oneembodiment. In this example, metadata layer 104 may include a redirectorserver 702 and multiple volume servers 704. Each volume server 704 maybe associated with a plurality of slice servers 706.

In this example, client 108 a wants to connect to a volume (e.g., clientaddress). Client 108 a communicates with redirector server 702,identifies itself by initiator name, and also indicates a volume bytarget name that client 108 a wants to connect to. Different volumeservers 704 may be responsible for different volumes. In this case,redirector server 702 is used to redirect the request to a specificvolume server 704. To client 108, redirector server 702 may represent asingle point of contact. The request from client 108 a then isredirected to a specific volume server 704. For example, redirectorserver 702 may use a database of volumes to determine which volumeserver 704 is a primary volume server for the requested target name. Therequest from client 108 a is then directed to the specific volume server704 causing client 108 a to connect directly to the specific volumeserver 704. Communications between client 108 a and the specific volumeserver 704 may then proceed without redirector server 702.

Volume server 704 performs functions as described with respect tometadata server 110. For each volume stored on volume server 704, a listof block identifiers is stored with one block identifier for eachlogical block on the volume. Each volume may be replicated between oneor more volume servers 704 and the metadata for each volume may besynchronized between each of the volume servers 704 hosting that volume.If volume server 704 fails, redirector server 702 may direct client 108to an alternate volume server 704.

In one embodiment, the metadata being stored on volume server 704 may betoo large for one volume server 704. Thus, multiple slice servers 706may be associated with each volume server 704. The metadata may bedivided into slices and a slice of metadata may be stored on each sliceserver 706. When a request for a volume is received at volume server704, volume server 704 determines which slice server 706 containsmetadata for that volume. Volume server 704 then routes the request tothe appropriate slice server 706. Accordingly, slice server 706 adds anadditional layer of abstraction to volume server 704.

When client 108 writes blocks of data (e.g., via the iSCSI protocol),volume server 704 may compress the data blocks and buffer the writtendata to local storage. Replication of the data to other volume servers704 may also be performed. After a period of time that may vary based onthe space available for buffering on volume server 704, the data blocksare sent to one or more block servers 112 based on their blockidentifier, and metadata in volume server 704 is updated with the blockidentifiers. The delay introduced by this buffering reduces the amountof data written to block servers 112. If a specific client address isoverwritten during the delay period, only the newer data blocks are sentto block servers 112.

When client 108 reads data blocks, volume server 704 determines if theclient address is in a local volume server buffer. If so, the data maybe returned from the local buffer. This may be faster than accessingblock servers 112. If the data blocks are not stored in the local volumeserver buffer, the block identifiers for the requested data blocks aredetermined using the metadata. Requests are sent to block servers 112that correspond to block identifiers to read the data blocks. As data isreturned from block servers 112 to volume servers 704, the data is sentback to client 108 to satisfy the request.

CONCLUSION

Particular embodiments provide many advantages. For example, data isstored in a space-efficient manner including de-duplication of data bothwithin a file or object and between files and objects that may belogically related to each other. The data de-duplication occurs in realtime or near real time without adding significant latency or overhead.Data may be spread among a number of block servers 112, each of whichmay include multiple storage devices, allowing system 100 to handlestorage of extremely large amounts of data. The data may be stored inany format, such as files, objects, fixed-size blocks, and variable sizeblocks.

When data is deleted from system 100, it may be removed in an efficientmanner. For example, the garbage collection method may be used. Data mayalso be compressed and de-compressed to save space in a manner that istransparent to client 108. Also, data may be stored in a redundantfashion such that the loss of any entity in metadata layer 104 or blockserver layer 106 will not impact the ability to store or retrieve datafrom system 100. Further, the actual space used by a subset of the data,taking into account the effects of de-duplication, may be efficientlycalculated.

Particular embodiments may use solid state storage devices. For example,solid state storage devices allow random access or random addressing ofdata that is as fast or nearly as fast as sequential access on aspinning disk. Also, solid state devices allow parallel reads/writes,which are not possible in spinning disks. The attributes of solid statedevices thus lend themselves to particular embodiments because data fora client address may be stored in random non-sequential locations and/ordifferent block servers 106. Because solid state devices may be randomlyaccessed very fast, particular embodiments may provide thede-duplication of data to use less storage space but provide accessefficiency as compared to spinning disks that store data sequentiallyand also may store duplicate data.

Particular embodiments may be implemented in a non-transitorycomputer-readable storage medium for use by or in connection with theinstruction execution system, apparatus, system, or machine. Thecomputer-readable storage medium contains instructions for controlling acomputer system to perform a method described by particular embodiments.The instructions, when executed by one or more computer processors, maybe operable to perform that which is described in particularembodiments.

As used in the description herein and throughout the claims that follow,“a”, “an”, and “the” includes plural references unless the contextclearly dictates otherwise. Also, as used in the description herein andthroughout the claims that follow, the meaning of “in” includes “in” and“on” unless the context clearly dictates otherwise.

The above description illustrates various embodiments of the presentinvention along with examples of how aspects of the present inventionmay be implemented. The above examples and embodiments should not bedeemed to be the only embodiments, and are presented to illustrate theflexibility and advantages of the present invention as defined by thefollowing claims. Based on the above disclosure and the followingclaims, other arrangements, embodiments, implementations and equivalentsmay be employed without departing from the scope of the invention asdefined by the claims.

What is claimed is:
 1. A method for writing data, the method comprising:based on receipt of a write request that includes data and a clientaddress for accessing the data, segmenting the data into storage units;computing a storage unit identifier for each of the storage units,wherein the storage unit identifier for each storage unit uniquelyidentifies content of the storage unit; determining, by a metadataserver, mappings between the storage unit identifiers to two or moreblock servers, wherein different sets of the storage unit identifiersmap to different ones of the two or more block servers; and sending thestorage units with their storage unit identifiers to the block serversbased upon the mappings, wherein each block server stores the one ormore of the storage units sent to the block server in a storage mediumof the block server and stores location information on where the storageunit is stored on the block server in association with the correspondingstorage unit identifier, and wherein multiple client addressesassociated with a same storage unit identifier resolve to a same blockserver location.
 2. The method of claim 1, further comprising receivinga confirmation from each of the two or more block servers that thecorresponding ones of the storage units have been stored.
 3. The methodof claim 2, further comprising indicating, for each storage unitidentifier, the location information of the storage unit in thecorresponding one of the block servers based on receipt of the locationinformation from the block servers.
 4. The method of claim 1, whereinthe mapping between each storage unit identifier to one of the two ormore block servers comprises a hash of the storage unit identifier. 5.The method of claim 1, wherein each of the two or more block serversupdates an in use flag corresponding to the storage unit.
 6. The methodof claim 1, wherein each of the two or more block servers compresses thestorage unit prior to storing the storage unit.
 7. The method of claim1, wherein each block server determines if the storage unit identifiersent to the block server already exists on the block server, wherein theblock server does not store the storage unit on the block server if thestorage unit identifier already exists on the block server, and whereinthe block server stores the storage unit if the storage unit identifierdoes not exist on the block server.
 8. The method of claim 1, furthercomprising mapping the client address to the storage unit identifiersand redundantly storing the mapping between the client address and thestorage unit identifiers in multiple metadata servers, wherein multiplewrite requests are performed to redundantly store the mapping.
 9. Anon-transitory computer-readable storage medium containing instructionsfor a metadata server to service requests for writing data in adistributed storage system, the instructions for controlling a computersystem to perform operations comprising: based on receipt of a writerequest that includes data and a client address for accessing the data,segmenting the data into storage units; computing a storage unitidentifier for each of the storage units, wherein the storage unitidentifier for each storage unit uniquely identifies content of thestorage unit; determining mappings between the storage unit identifiersto two or more block servers, wherein different sets of the storage unitidentifiers map to different ones of the two or more block servers; andsending the storage units and their corresponding storage unitidentifiers to the two or more block servers based upon the mappings,wherein each block server stores the one or more of the storage unitssent to the block server in a storage medium of the block server andstores location information on where the storage unit is stored on theblock server in association with the corresponding storage unitidentifier, and wherein multiple client addresses associated with a samestorage unit identifier resolve to a same block server location.
 10. Thenon-transitory computer-readable storage medium of claim 9, wherein theoperations further comprise receiving a confirmation from each of thetwo or more block servers that the corresponding ones of the storageunits have been stored.
 11. The non-transitory computer-readable storagemedium of claim 9, wherein the operations further comprise indicating,for each storage unit identifier, the location information of thestorage unit in the corresponding one of the block servers based onreceipt of the location information from the block servers.
 12. Thenon-transitory computer-readable storage medium of claim 9, wherein themapping between each storage unit identifier to one of the two or moreblock servers comprises a hash of the storage unit identifier.
 13. Thenon-transitory computer-readable storage medium of claim 9, wherein eachof the two or more block servers updates an in use flag corresponding tothe storage unit.
 14. The non-transitory computer-readable storagemedium of claim 9, wherein each of the two or more block serverscompresses the storage unit prior to storing the storage unit.
 15. Thenon-transitory computer-readable storage medium of claim 9, whereincomputing a storage unit identifier for each of the one or more storageunits comprises computing a hash of content for a respective storageunit.
 16. The non-transitory computer-readable storage medium of claim9, wherein the operations further comprise mapping the client address tothe storage unit identifiers and redundantly storing the mapping betweenthe client address and the storage unit identifiers in multiple metadataservers, wherein multiple write requests are performed to redundantlystore the mapping.
 17. A system comprising: a metadata server comprisinga processor and a non-transitory machine-readable medium having storedtherein instructions executable by the processor to cause the metadataserver to: based on receipt of a write request that includes data and aclient address for accessing the data, segment the data into storageunits; compute a storage unit identifier for each of the storage units,wherein the storage unit identifier for each storage unit uniquelyidentifies content of the storage unit; determine mappings between thestorage unit identifiers to two or more block servers, wherein differentsets of the storage unit identifiers map to different ones of the two ormore block servers; and send the storage units and their correspondingstorage unit identifiers to the two or more block servers based upon themappings, wherein multiple client addresses associated with a samestorage unit identifier resolve to a same block server location; and twoor more block servers each comprising a processor, storage media, and anon-transitory machine-readable medium having stored thereininstructions executable by the processor to cause the block server to:store in the storage media a storage unit from the metadata server andsend location information on where the storage unit is stored on theblock server in association with the storage unit identifier to themetadata server.
 18. The system of claim 17, wherein themachine-readable medium of each of the two or more block servers furtherhas stored therein instructions executable by the processor of the blockserver to cause the block server to compress the storage unit prior tostoring the storage unit.
 19. The system of claim 17, wherein thenon-transitory machine-readable medium of the metadata server furtherhas stored therein instructions executable by the processor of themetadata server to cause the metadata server to associate each storageunit identifier with corresponding location information from the two ormore block servers.